package com.antsoft.command;

import net.sf.jasperreports.engine.JasperCompileManager;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import org.springframework.util.ResourceUtils;

/**
 * Created by Jason on 2017/4/15.
 * 启动时编译模板文件至jrxml->jasper
 */
@Component
public class InitJasperreport implements CommandLineRunner {
    @Override
    public void run(String... strings) throws Exception {
        JasperCompileManager.compileReportToFile(InitJasperreport.class.getClassLoader().getResource("").getPath()+"jasper/test_demo.jrxml");
        JasperCompileManager.compileReportToFile(InitJasperreport.class.getClassLoader().getResource("").getPath()+"jasper/TableReport.jrxml");
    }
}
